<template>
	<div class="box">
		<div class="null-page" v-show="yes"></div>
		
		<el-card class="box-card order-list">
			<div slot="header" class="clearfix"><span>团长列表</span></div>
			<div v-loading="loading">
				<template>
					<el-table
						:data="agentChildList"
						style="width: 100%">
						<el-table-column
						label="用户名"
						width="180">
						<template slot-scope="scope">
							<span style="margin-left: 10px">{{ scope.row.username }}</span>
						</template>
						</el-table-column>
                        <el-table-column
						label="成为下级时间"
						width="180">
						<template slot-scope="scope">
                            <i class="el-icon-time"></i>
							<span style="margin-left: 10px">{{$util.timeStampTurnTime(scope.row.create_time)}}</span>
						</template>
						</el-table-column>
                        <el-table-column
						label="订单数量(个)"
						width="180">
						<template slot-scope="scope">
							<span style="margin-left: 10px">{{scope.row.order_num}}</span>
						</template>
						</el-table-column>
                        <el-table-column
						label="获利总额(元)"
						width="180">
						<template slot-scope="scope">
							<span style="margin-left: 10px">{{scope.row.commission_money}}</span>
						</template>
						</el-table-column>
                        <el-table-column
						label="返佣总额(元)"
						width="180">
						<template slot-scope="scope">
							<span style="margin-left: 10px">{{scope.row.superior_commission_money}}</span>
						</template>
						</el-table-column>
					</el-table>
				</template>
			</div>
		</el-card>
	</div>
</template>

<script>
import { mapGetters } from 'vuex';
// import { apiOrderList } from '@/api/order/order';
import { apiAgent_check, getAgentCheck, AgentChildList } from '@/api/member/index';
import orderMethod from '@/utils/orderMethod';
export default {
	name: 'pingtuanlist',
	components: {},
	data: () => {
		return {
			checkStatus: 'all',
			loading: true,
            agentChildList: [],
			currentPage: 1,
			pageSize: 10,
			total: 0,
			yes: true,
			//拒绝理由
			reason: '',
		};
	},
	mixins: [orderMethod],
	created() {
		this.checkStatus = this.$route.query.status || 'all';
        // this.getAgentCheckList();
        this.getAgentChildList();
	},
	computed: {
		...mapGetters(['defaultGoodsImage'])
	},
	mounted() {
		let self = this;
		setTimeout(function() {
			self.yes = false
		}, 300)
	},
	methods: {
		handleClick(tab, event) {
			this.currentPage = 1;
			this.checkStatus = tab.name;
			this.refresh();
        },
        getAgentChildList() {
            AgentChildList({
                page: this.currentPage,
                page_size: this.pageSize,
            })
                .then(res => {
                    let list = [];
                    if(res.code == 0) {
                        list = res.data.list;
                        this.total = res.data.count;
                    }
                    this.agentChildList = list;
                    this.loading = false;
                })
                .catch(res => {
                    this.loading = false;
                });
        },
		handlePageSizeChange(size) {
			this.pageSize = size;
			this.refresh();
		},
		handleCurrentPageChange(page) {
			this.currentPage = page;
			this.refresh();
		},
		refresh() {
			this.loading = true;
			//this.getAgentCheckList();
		},
		imageError(orderIndex, goodsIndex) {
			this.orderList[orderIndex].order_goods[goodsIndex].sku_image = this.defaultGoodsImage;
		}
	}
};
</script>
<style lang="scss" scoped>
.box {
	width: 100%;
	position: relative;
}

.null-page {
	width: 100%;
	height: 730px;
	background-color: #FFFFFF;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 9;
}

.order-list {
	nav {
		overflow: hidden;
		padding: 10px 0;
		background: #fff;
		margin-bottom: 10px;
		border-bottom: 1px solid #eeeeee;
		li {
			float: left;
			&:nth-child(1) {
				width: 45%;
			}
			&:nth-child(2) {
				width: 10%;
			}
			&:nth-child(3) {
				width: 10%;
			}
			&:nth-child(4) {
				width: 10%;
			}
			&:nth-child(5) {
				width: 15%;
			}
			&:nth-child(6) {
				width: 10%;
			}
		}
	}
	.list {
		.item {
			margin-bottom: 20px;
			border: 1px solid #eeeeee;
			border-top: 0;
			.head {
				padding: 8px 10px;
				background: #f7f7f7;
				font-size: 12px;

				.create-time {
					margin-right: 10px;
				}

				border-bottom: 1px solid #eeeeee;
				a {
					margin: 0 10px 0 20px;
				}

				.order-type {
					margin-left: 30px;
				}
			}
		}
		ul {
			background-color: #fff;
			padding: 10px;
			overflow: hidden;
			li {
				float: left;
				line-height: 60px;
				&:nth-child(1) {
					width: 45%;
					line-height: inherit;
					.img-wrap {
						width: 60px;
						height: 60px;
						float: left;
						margin-right: 10px;
						cursor: pointer;
					}
					.info-wrap {
						margin-left: 70px;
						h5 {
							font-weight: normal;
							font-size: $ns-font-size-base;
							display: -webkit-box;
							-webkit-box-orient: vertical;
							-webkit-line-clamp: 2;
							overflow: hidden;
							margin-right: 10px;
							display: inline-block;
							cursor: pointer;
							&:hover {
								color: $base-color;
							}
						}
						span {
							font-size: $ns-font-size-sm;
							color: #9a9a9a;
						}
					}
				}
				&:nth-child(2) {
					width: 10%;
				}
				&:nth-child(3) {
					width: 10%;
				}
				&:nth-child(4) {
					width: 10%;
				}
				&:nth-child(5) {
					width: 15%;
					line-height: 30px;
					a {
						display: block;
					}
				}
				&:nth-child(6) {
					width: 10%;
					line-height: initial;
					button {
						margin-left: 0;
						margin-bottom: 10px;
						&:last-child {
							margin-bottom: 0;
						}
					}
				}
			}
		}
	}
	.empty-wrap {
		text-align: center;
		padding: 10px;
	}
}
</style>
